<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        ul {
            list-style: none;
        }

        .box {
            width: 1226px;
            height: 460px;
            margin: 50px auto 0;
            position: relative;
            overflow: hidden;
        }

        .circle {
            width: 100px;
            height: 50px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            position: absolute;
            right: 20px;
            bottom: 0px;
            z-index: 2;
        }

        .circle>li {
            width: 10px;
            height: 10px;
            border: 1px solid black;
            border-radius: 50%;

        }

        .circle>.reveal {
            background-color: orange;
        }

        .picture {
            width: max-content;
            overflow: hidden;
            position: relative;
        }

        .picture>li {
            width: 1226px;
            height: 100%;
            /* display: none; */
            float: left;
        }

        .picture>li>img {
            width: 100%;
            height: 100%;
        }

        .picture>.show {
            display: block;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul class="circle">
            <li class="reveal"></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
        <ul class="picture">
            <li class="show">
                <img src="../赵江杰月考-2/images/1.jpg" alt="">
            </li>
            <li>
                <img src="../赵江杰月考-2/images/2.jpg" alt="">
            </li>
            <li>
                <img src="../赵江杰月考-2/images/3.webp" alt="">
            </li>
            <li>
                <img src="../赵江杰月考-2/images/4.webp" alt="">
            </li>
            <li class="show">
                <img src="../赵江杰月考-2/images/1.jpg" alt="">
            </li>
        </ul>
    </div>
</body>
<script>
    var box = document.getElementsByClassName("box")[0];
    var circleList = document.querySelectorAll(".circle li");
    var pictureList = document.querySelectorAll(".picture li");

    var index = 0;
    var timer = null;

    var swiperWidth = box.clientWidth;  // 一张图片的宽度

    // 自动轮播
    function autoplay(){
        clearInterval(timer);
        timer = setInterval(function(){
            
        })
    }

    function animate(ele, attr, end, aniType="linear") {
        var site = parseFloat(getStyle(ele, attr));
        end = parseFloat(end);

        var speed = 0;
        clearTimeout(move);
        move = setInterval(function () {

            if (aniType == "linear") {
                speed = end >= site ? 10 : -10
            } else if (aniType == "ease-in") {
                speed = end >= site ? speed + 2 : speed - 2
            } else if (aniType == "ease-out") {
                speed = Math.ceil(Math.abs(end - site) / 10);
                speed = end >= site ? speed : -speed
            }

            site += speed;
            console.log(speed,site);
            ele.style[attr] = site + "px";
            if (Math.abs(end - site) <= Math.abs(speed)) {
                clearTimeout(move);
                ele.style[attr] = end + "px";
            } 
            else {
                ele.style[attr] = site + "px";

            }
        }, 25)
    }

    function getStyle(ele, attr) {
        if (window.getComputedStyle) {
            return window.getComputedStyle(ele)[attr];
        } else {
            return ele.currentStyle[attr];
        }
    }
</script>

</html>